package Entity;

import javax.persistence.*;
import java.util.*;

public class client {


 public static void main(String[] args) throws Exception 
  {   	  
     	EntityManagerFactory factory =
       Persistence.createEntityManagerFactory("PCR_System",null);
       EntityManager manager = factory.createEntityManager();
      try 
      {         
    	         
				 showAll(manager);
      } 
      finally 
      {
         manager.close();
         factory.close();
      }
   }

   
  
  public static void showAll(EntityManager manager)
   {
   	     EntityTransaction transaction = manager.getTransaction();
   	     transaction.begin();
  	     Query q=manager.createQuery("FROM User u");
         List<?> results=q.getResultList();
        transaction.commit();
         Iterator<?> it=results.iterator();
         while(it.hasNext())
        {
        	 User u=(User)it.next();
        	  System.out.println(u);
         }
   }
}






